﻿using HelpDeskTool.Entities;

namespace HelpDeskTool.Extensions;

public static class DetailInfoExt
{
	public static DetailInfo Merge(this DetailInfo? merged, DetailInfo detailInfo)
	{
		var res = new DetailInfo
		{
			Hardware = detailInfo.Hardware ?? merged?.Hardware,
			IpAddresses = detailInfo.IpAddresses ?? merged?.IpAddresses,
			OperatingSystem = detailInfo.OperatingSystem ?? merged?.OperatingSystem,
			LastBootUp = detailInfo.LastBootUp ?? merged?.LastBootUp,
			Updated = detailInfo.Updated ?? merged?.Updated
		};

		return res;
	}
}
